package com.example.xianji.adapter;

import java.util.List;

import com.example.xianji.R;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class Search_Adapter extends BaseAdapter {
    private Context mContext;
    private List<String> text_list;

    public Search_Adapter(Context mContext, List<String> text_list) {
        super();
        this.mContext = mContext;
        this.text_list = text_list;
    }

    @Override
    public int getCount() {
        return text_list.size();
    }

    @Override
    public Object getItem(int position) {
        return position;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        Holder mHolder;
        if (convertView == null) {
            mHolder = new Holder();
            convertView = View.inflate(mContext, R.layout.jilu_listview_item, null);
            mHolder.jilu_text = (TextView) convertView.findViewById(R.id.jilu_text);
            convertView.setTag(mHolder);
        }
        mHolder = (Holder) convertView.getTag();
        mHolder.jilu_text.setText(text_list.get(position));
        return convertView;
    }

    class Holder {
        TextView jilu_text;
    }
}
